/** 
 * @(#)Knoten.java
 */

/**
 * @author Robert Denda&Didier Gutacker
 * @version 1.1
 * @see Node
 * @see NodeRIP 
 *
 * original author Robert Denda, changes made by Didier Gutacker
 */

import java.awt.*;
import java.util.*;

public abstract class Knoten extends ArchitectureComponent {
  protected Vector attachedLinks;

  protected Image nodeImage;
  protected MediaTracker tracker;

  protected FontMetrics fontMetrics;
  protected final int NODE_IMAGE = 0;
  protected boolean initialized = false;	// initialization flag
  protected int textHeight;

  protected Lock attachedLinksGuard;
  protected Lock sharedv;
 
  
 
  public Knoten( int id, SimulationObject net, Graphics gc, int xpos, int ypos, int width, int height ) {
    super( id, net, gc, xpos, ypos, width, height );
    nodeImage = net.getSimulation().getRouterImage();
    attachedLinks = new Vector();
    fontMetrics = gc.getFontMetrics();
    textHeight = fontMetrics.getAscent() + fontMetrics.getDescent() + 1;
    initialized = true;
    attachedLinksGuard = new Lock(); 
    sharedv            = new Lock();
  }

  synchronized public void unmark() {
    gc.clearRect( absXPos, absYPos, width, height );
    marked = false;
    paintRequest();
  } // Knoten.unmark

  public Vector getLinks() {
    attachedLinksGuard.acquire();
    Vector returnValue = attachedLinks;
    attachedLinksGuard.release();
    return returnValue;
  } // Knoten.getLinks


} // Knoten







